package chapter06.Example7;

import java.util.HashSet;
import java.util.Iterator;

public class Example7 {
    public static void main(String[] args) {
        HashSet set = new HashSet();
        set.add("张三");
        set.add("李四");
        set.add("王五");
        set.add("李四");
        System.out.println(set);
        //hashset返回一个迭代器
        Iterator iterator = set.iterator();
        while (iterator.hasNext()){
            Object o = iterator.next();
            System.out.println(o);
        }
    }
}
